
package org.openhds.domain.model;

import java.io.Serializable;
import java.util.Calendar;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.openhds.domain.annotations.Description;
import org.openhds.domain.constraint.CheckCalendar;
import org.openhds.domain.constraint.CheckEntityNotVoided;
import org.openhds.domain.constraint.CheckIndividualGenderFemale;
import org.openhds.domain.constraint.CheckIndividualNotUnknown;
import org.openhds.domain.constraint.ExtensionIntegerConstraint;
import org.openhds.domain.constraint.Searchable;


/**
 * Generated by JCodeModel
 * 
 */
@Description(description = "A Pregnancy Observation is used to monitor a pregnancy. It contains information about the mother who is pregnant, the date the pregnancy started, as well as the expected delivery date.")
@Entity
@Table(name = "pregnancyobservation")
@XmlRootElement(name = "pregnancyobservation")
public class PregnancyObservation
    extends VisitableEntity
    implements Serializable
{

    public final static long serialVersionUID = -4737117368371754337L;
    @CheckIndividualNotUnknown
    @Searchable
    @CheckIndividualGenderFemale(allowNull = true, message = "The mother specified is not female gender")
    @CheckEntityNotVoided(allowNull = true, message = "The mother has been voided")
    @ManyToOne(cascade = {
        CascadeType.MERGE,
        CascadeType.PERSIST
    }, targetEntity = org.openhds.domain.model.Individual.class)
    @Description(description = "The mother of the pregnancy observation, identified by the external id.")
    private Individual mother;
    @Searchable
    @ManyToOne
    @Description(description = "House in which this Pregnancy Observation took place.")
    private Location house;
    @Searchable
    @ManyToOne
    @Description(description = "Household in which this Pregnancy Observation took place.")
    private SocialGroup household;
    @NotNull
    @CheckCalendar(message = "Expected Delivery Date is invalid")
    @Temporal(TemporalType.DATE)
    @Description(description = "Expected delivery date.")
    private Calendar expectedDeliveryDate;
    @NotNull
    @CheckCalendar(message = "Recorded Date is invalid")
    @Temporal(TemporalType.DATE)
    @Description(description = "Recorded date of the pregnancy observation.")
    private Calendar recordedDate;
    @Description(description = "Name of the household in which this pregnany observation occurred")
    private String householdName;
    @Description(description = "If other, please specify the health facility")
    private String healthFacilityOther;
    @Description(description = "Estimated date of conception of the pregnancy observation")
    @CheckCalendar(message = "Invalid value for date")
    @Temporal(TemporalType.DATE)
    @Past
    private Calendar estimatedDateOfConception;
    @Description(description = "Name of pregnant woman")
    private String pregWomanName;
    @Description(description = "Who reported this pregnancy observaton")
    @ExtensionIntegerConstraint(constraint = "reportedByConstraint", message = "Invalid Value for reportedBy", allowNull = true)
    private Integer reportedBy;
    @Description(description = "Number of months of pregnancy")
    private Integer numMonthsOfPregnancy;
    @Description(description = "Is this the mother's first pregnancy?")
    @ExtensionIntegerConstraint(constraint = "yesNoConstraint", message = "Invalid Value for firstPregnancy", allowNull = true)
    private Integer firstPregnancy;
    @Description(description = "Did the mother attend an anti-natal clinic?")
    @ExtensionIntegerConstraint(constraint = "yesNoConstraint", message = "Invalid Value for attendedAnteNatalClinic", allowNull = true)
    private Integer attendedAnteNatalClinic;
    @Description(description = "Which health facility did the mother attend?")
    @ExtensionIntegerConstraint(constraint = "healthFacilityConstraint", message = "Invalid Value for healthFacility", allowNull = true)
    private Integer healthFacility;
    @Description(description = "Did the mother receive a TT injection?")
    @ExtensionIntegerConstraint(constraint = "yesNoConstraint", message = "Invalid Value for receivedTTInjection", allowNull = true)
    private Integer receivedTTInjection;

    public Individual getMother() {
        return mother;
    }

    public void setMother(Individual mom) {
        mother = mom;
    }

    public Location getHouse() {
        return house;
    }

    public void setHouse(Location place) {
        house = place;
    }

    public SocialGroup getHousehold() {
        return household;
    }

    public void setHousehold(SocialGroup place) {
        household = place;
    }

    @XmlJavaTypeAdapter(org.openhds.domain.util.CalendarAdapter.class)
    public Calendar getExpectedDeliveryDate() {
        return expectedDeliveryDate;
    }

    public void setExpectedDeliveryDate(Calendar date) {
        expectedDeliveryDate = date;
    }

    @XmlJavaTypeAdapter(org.openhds.domain.util.CalendarAdapter.class)
    public Calendar getRecordedDate() {
        return recordedDate;
    }

    public void setRecordedDate(Calendar date) {
        recordedDate = date;
    }

    @Override
    public String toString() {
        return "Pregnancy Observation";
    }

    public String getHouseholdName() {
        return householdName;
    }

    public void setHouseholdName(String data) {
        householdName = data;
    }

    public String getHealthFacilityOther() {
        return healthFacilityOther;
    }

    public void setHealthFacilityOther(String data) {
        healthFacilityOther = data;
    }

    @XmlJavaTypeAdapter(org.openhds.domain.util.CalendarAdapter.class)
    public Calendar getEstimatedDateOfConception() {
        return estimatedDateOfConception;
    }

    public void setEstimatedDateOfConception(Calendar data) {
        estimatedDateOfConception = data;
    }

    public String getPregWomanName() {
        return pregWomanName;
    }

    public void setPregWomanName(String data) {
        pregWomanName = data;
    }

    public Integer getReportedBy() {
        return reportedBy;
    }

    public void setReportedBy(Integer data) {
        reportedBy = data;
    }

    public Integer getNumMonthsOfPregnancy() {
        return numMonthsOfPregnancy;
    }

    public void setNumMonthsOfPregnancy(Integer data) {
        numMonthsOfPregnancy = data;
    }

    public Integer getFirstPregnancy() {
        return firstPregnancy;
    }

    public void setFirstPregnancy(Integer data) {
        firstPregnancy = data;
    }

    public Integer getAttendedAnteNatalClinic() {
        return attendedAnteNatalClinic;
    }

    public void setAttendedAnteNatalClinic(Integer data) {
        attendedAnteNatalClinic = data;
    }

    public Integer getHealthFacility() {
        return healthFacility;
    }

    public void setHealthFacility(Integer data) {
        healthFacility = data;
    }

    public Integer getReceivedTTInjection() {
        return receivedTTInjection;
    }

    public void setReceivedTTInjection(Integer data) {
        receivedTTInjection = data;
    }

}
